<?php

namespace App\V3\V3_2_7\Services;

use App\V3\V3_2_7\Models\DispatchListModel;
use App\V3\V3_2_7\Models\DeliverySlipModel;
use App\V3\V3_2_7\Models\ReceiptModel;
use App\V3\V3_2_7\Models\MedicalDeliverOrderModel;
use App\V3\V3_2_7\Models\QuotationNoModel;
use App\V3\V3_2_7\Models\MedicalDeliveryOrderModel;
class DispatchListService
{
    static public function add($data){

        return DispatchListModel::add($data);
    }

    static public function update($condition,$data){

        return DispatchListModel::upd($condition,$data);
    }
    static public function delete($condition){
        return DispatchListModel::del($condition);
    }
    static public function getDispatchListInfo($condition){

        return DispatchListModel::getDispatchListInfo($condition);
    }

    static public function getList($condition,$dispatch_id_arr,$pageSize,$pageNo){

        return DispatchListModel::getList($condition,$dispatch_id_arr,$pageSize,$pageNo);
    }

    /**
     * 计算空白单据总数
     */
    static public function countReceiptsTotal($condition){

        $count01 = ReceiptModel::where($condition)->count();//10

        $count02 = DispatchListModel::where($condition)->count();//9

        $count03 = DeliverySlipModel::where($condition)->count();//6

        $count04 = QuotationNoModel::where($condition)->count();  //2

        $count05 = MedicalDeliverOrderModel::where($condition)->count();//5

        $count06 = MedicalDeliveryOrderModel::where($condition)->count();//7

        $count   = $count01+$count02+$count03+$count04+$count05+$count06;

        return $count;
    }
}
